home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / bcsrce2.zip / CHEKBOX2.BC < prev    next >
Text File  |  1990-10-15  |  3KB  |  122 lines

  1. let %!a = %1
  2. if %!a# = # goto ERROR
  3. let %!z = %!a
  4. gt %!z 21
  5. if errorlevel 1 goto ERROR
  6. if %!a = 0 Let %!a = 10
  7. goto TEST1
  8. :TEST1
  9. let %!b = %2
  10. if %!b# = # goto ERROR
  11. let %!z = %!b
  12. gt %!z 65
  13. if errorlevel 1 goto ERROR
  14. if %!b = 0 Let %!b = 30
  15. erase yes.yes > nul
  16. erase no.no > nul
  17. let %!p = %3
  18. if %!p# = # let %!p = y
  19. lower %!p
  20. if %!p = yes let %!p = y
  21. if %!p = y let %!e = 1
  22. if %!p = no let %!p = n
  23. if %!p = n let %!e = 1
  24. if not %!e@ = 1@ goto ERROR
  25. if %!p = y GOSUB YES
  26. if %!p = n GOSUB NO
  27. goto CHOOSE
  28. :YES
  29. locate %!a %!b
  30. echonolf ╔═════╗   ┌─────┐
  31. let %!s = %!a
  32. add %!s 1
  33. locate %!s %!b
  34. echonolf ║ Yes ║   │ No! │
  35. add %!s 1
  36. locate %!s %!b
  37. echonolf ╚═════╝   └─────┘
  38. return
  39. :NO
  40. locate %!a %!b
  41. echonolf ┌─────┐   ╔═════╗
  42. let %!s = %!a
  43. add %!s 1
  44. locate %!s %!b
  45. echonolf │ Yes │   ║ No! ║
  46. add %!s 1
  47. locate %!s %!b
  48. echonolf └─────┘   ╚═════╝
  49. return
  50. :CHOOSE
  51. rem 3840=Shift tab, 121=y, 110=n, 89=Y, 78=N, 27=Esc, 13=Enter, 9=Tab
  52. rem Left arrow=19200, Right arrow=19712
  53. getkey
  54. if errlevel 19712 GOTO ARROW
  55. if errlevel 19200 GOTO ARROW
  56. if errlevel 3840 GOTO ARROW
  57. if errlevel 121 GOTO MAKEYES
  58. if errlevel 110 GOTO MAKENO
  59. if errlevel 89 GOTO MAKEYES
  60. if errlevel 78 GOTO MAKENO
  61. if errlevel 27 GOTO END
  62. if errlevel 13 GOTO ENTER
  63. if errlevel 9 GOTO ARROW
  64. goto CHOOSE
  65. :ARROW
  66. if %!p = y GOTO YES_NO
  67. if %!p = n GOTO NO_YES
  68. goto CHOOSE
  69. :YES_NO
  70. GOSUB NO
  71. let %!p = n
  72. goto CHOOSE
  73. :NO_YES
  74. GOSUB YES
  75. let %!p = y
  76. goto CHOOSE
  77. :ENTER
  78. if %!p = y GOTO MAKEYES
  79. if %!p = n GOTO MAKENO
  80. :MAKEYES
  81. GOSUB YES
  82. TYPE YES.YES > YES.YES
  83. GOTO END
  84. :MAKENO
  85. GOSUB NO
  86. TYPE NO.NO > NO.NO
  87. GOTO END
  88. :SYNTAX
  89. echo.
  90. echo       SYNTAX---:  CHEKBOX [ROW(1-21)] [COLUMN(1-65)] [yes]/[no]
  91. echo       USAGE----:  Use in .BAT programs to interreact with users. Program-
  92. echo                   mer positions a yes/no check box at given row/column
  93. echo                   coordinates. An option is provided to preselect either
  94. echo                   yes or no. The default is CHEKBOX 10 30 yes.
  95. echo                   You can choose the defaults by using CHEKBOX 0 0 so long
  96. echo                   as they are not out of alignment. In other words, yes or
  97. echo                   no MUST be the third parameter, parameter two cannot ex-
  98. echo                   ceed 65, and parameter one must be less than 22. User
  99. echo                   has these keypresses to choose from left/right cursor,
  100. echo                   tab, shift tab, Enter, ESCape, Y, y, N, and n.
  101. echo.
  102. echo       EXAMPLE--:  CHECKBOX 17 30 no
  103. echo       EXAMPLE--:  CHEKBOX 5 0  {column 30 and yes is defaulted to}
  104. echo       EXAMPLE--:  CHEKBOX 0 0  {row 10, column 30 and yes is defaulted to}
  105. echo                   Only the yes/no can be omitted.
  106. echo.
  107. echo     One of two zero byte files are created dependent upon user's choice.
  108. echo     If yes, YES.YES. If no, NO.NO. Use IF EXIST for the test.
  109. echo.
  110. echo       Public Domain BATCOM program example, 1990, by Felix A. Rozewicz
  111. goto END
  112. :ERROR
  113. echo  Unable to verify validity of first 2 primary parameters.
  114. echo  Or, there is an error in typing yes/no parameter.
  115. beep
  116. echo.
  117. waitkey 2
  118. goto SYNTAX
  119. :END
  120. EXIT
  121.  
  122.